<section class="content-header">
    <h1>
        内容管理
        <small></small>
    </h1>
</section>

<!-- Main content -->
<section class="content">
    <div class="row">
        <!-- /.col -->
        <div class="col-md-12">
            <div class="box">
                <div class="box-header with-border">
                    <h3 class="box-title">广告管理</h3>
                    <!-- /.box-tools -->
                </div>
                <!-- /.box-header -->
                <div class="box-body no-padding">
                    <div class="mailbox-controls">
                        <div class="btn-group">
                            <a href="/admin/ads/add" class="btn btn-danger ">
                                新增广告
                            </a>
                        </div>
                        <!-- /.btn-group -->
                    </div>
                    <div class="table-responsive" style="overflow-x: visible;">
                        <table class="table table-bordered table-hover">
                            <tbody>
                            <tr>
                                <th class="hidden-xs">
                                    <label><input onchange="checkAll()" type="checkbox" value=""></label>
                                </th>
                                <th>ID</th>
                                <th>类型</th>
                                <th>名称</th>
                                <th>介绍</th>
                                <th>链接</th>
                                <th>图片</th>
                                <th>状态</th>
                                <th>排序</th>
                                <th>备注</th>
                                <th>时间</th>
                                <th>操作</th>
                            </tr>

                            {{#each ads}}
                                <tr>
                                    <td class="hidden-xs">
                                        <label><input name="checkbox" class="check" type="checkbox"
                                                      value="{{id}}"></label>
                                    </td>
                                    <td>
                                        {{id}}
                                    </td>
                                    <td>
                                        {{#eq type 1}}
                                        <span class="label label-primary">幻灯片</span>
                                        {{/eq}}

                                        {{#eq type 2}}
                                        <span class="label label-info">插件</span>
                                        {{/eq}}

                                        {{#eq type 3}}
                                        <span class="label label-warning">广告位1</span>
                                        {{/eq}}

                                        {{#eq type 4}}
                                        <span class="label label-success">广告位2</span>
                                        {{/eq}}
                                        
                                        {{#eq type 5}}
                                        <span class="label label-default">学院幻灯片</span>
                                        {{/eq}}
                                    </td>
                                    <td>
                                        {{name}}
                                    </td>
                                    <td>
                                        {{ellipsis sub 12}}
                                    </td>
                                    <td>
                                        {{url}}
                                    </td>
                                    <td>
                                        <div class="btn-group" style="margin: 0px">
                                            <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                                图片<span class="caret"></span></button>
                                            <div class="dropdown-menu">
                                                <img style="height: 200px"
                                                     src="/public/uploads/{{file.savepath}}{{file.savename}}">
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        {{#eq status 1}}
                                        <span class="label label-success">开启</span>
                                        {{else}}
                                        <span class="label label-default">关闭</span>
                                        {{/eq}}
                                    </td>
                                    <td>
                                       {{rank}}
                                    </td>
                                    <td>
                                        {{remark}}
                                    </td>
                                    <td>
                                        {{moment created_at 'YYYY-MM-DD HH:mm:ss'}}
                                    </td>
                                    <td class="table-action">
                                        <a href="/admin/ads/add?id={{id}}">编辑</a>
                                        {{#eq status 1}}<a href="/admin/ads/update?id={{id}}&status=0">关闭</a>{{/eq}}
                                        {{#eq status 0}}<a href="/admin/ads/update?id={{id}}&status=1">开启</a>{{/eq}}
                                    </td>
                                </tr>
                            {{/each}}

                            </tbody>
                        </table>
                        <div class="box-footer no-padding">
                            <div class="mailbox-controls">
                                <div class="btn-group">
                                    <button type="button" class="btn btn-danger "
                                            onclick="batchUrl('/admin/ads/update?status=1')">开启
                                    </button>
                                </div>
                                <div class="btn-group">
                                    <button type="button" class="btn btn-danger "
                                            onclick="batchUrl('/admin/ads/update?status=0')">
                                        关闭
                                    </button>
                                </div>
                                <div class="pull-right">
                                    {{{page}}}
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- /.mail-box-messages -->
                </div>
            </div>
            <!-- /. box -->
        </div>
        <!-- /.col -->
    </div>
</section>